<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>会员中心</title>
    <link rel="stylesheet" type="text/css" href="/Public/vendor/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/assets/home/css/common.css"/>
</head>
<body class="confirm-page">
<section class="confirm">
    <h3>请完善您的个人信息</h3>

    <dl class="address">
        <dt class="fa fa-user">&nbsp;&nbsp; 姓名：黄栋进</dt><br/>
        <dt class="fa fa-star-o">&nbsp;&nbsp; 生日：1986-08-04</dt><br/>
        <dt class="fa fa-mobile">&nbsp;&nbsp; 手机：13419566683</dt><br/>
        <dt class="fa fa-inbox">&nbsp;&nbsp; 邮箱：244500972@qq.com</dt>
    </dl>

    <p id="createAddress"><b class="fa fa-edit"></b> 修改个人信息</p>

    <div class="address-form" style="padding-bottom: 14px;">
        <div class="control">
            <label>姓名</label>
            <input name="nickname" type="text" placeholder="请填写姓名" />
        </div>

        <div class="control">
            <label>生日</label>
            <input name="birthday" type="text" placeholder="请填写生日" />
        </div>

        <div class="control">
            <label>手机</label>
            <input name="tel" type="text" placeholder="请填写手机号" />
        </div>

        <div class="control">
            <label>邮箱</label>
            <input name="email" type="text" placeholder="电子邮箱（选填）" />
        </div>

        <p class="operate">
            <a id="save" class="primary save_userInfo" href="">保存</a>
        </p>
    </div>
</section>

<script type="text/javascript" src="/Public/assets/home/js/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        //填写信息
        $('#save').click(function(){
            var $nickname = $('input[name="nickname"]');
            var $birthday = $('input[name="birthday"]');
            var $tel = $('input[name="tel"]');
            var $email = $('input[name="email"]');
            data = {
                nickname: $.trim($nickname.val()),
                birthday: $.trim($birthday.val()),
                tel: $.trim($tel.val()),
                email: $.trim($email.val())
            };

            if(data.nickname == ""){
                $nickname.css('border-color', '#f00');
                return false;
            } else {
                $nickname.css('border-color', '#ccc');
            }
            if(data.tel == ""){
                $tel.css('border-color', '#f00');
                return false;
            } else if(!/^1\d{10}$/.test(data.tel)){
                $tel.css('border-color', '#f00');
                return false;
            } else {
                $tel.css('border-color', '#ccc');
            }
            if(data.birthday == ""){
                $birthday.css('border-color','#f00');
                return false;
            } else {
                $birthday.css('border-color', '#ccc');
            }
            if(data.email == ""){
                $eamil.css('border-color', '#f00');
                return false;
            } else {
                $email.css('border-color', '#ccc');
            }

            $.post("{:U('userInfo')}",{
                data:data
            },function(respone){
                console.log(respone);
//                if (respone.status == 1) {
//
//                }
            },'json');

            return false;

        })
    });
</script>
</body>
</html>